#ifndef TEXTURESYSTEM_H
#define TEXTURESYSTEM_H
#include "StompedReality/Asset/TextureInfo.h"
#include "StompedReality/Core.h"
#include "StompedReality/Core/GameAccess.h"
namespace StompedReality
{
namespace Asset
{
class DLL_EXPORT TextureSystem : public StompedReality::GameAccess
{
 private:

  StompedReality::Asset::TextureInfo* m_TextureList;
  int m_Capacity;

 public:

  bool OpenTexture ( ID id, const char* fileName, bool global = false  );
  bool OpenTexture ( StompedReality::Asset::TextureInfo& info, const char* fileName );

  //! \brief	Constructor.
  TextureSystem( );

  //! \brief	Destructor.
  virtual ~TextureSystem( );

  //! \brief	Initialize.
  void Initialize ( int capacity );

  //! \brief	Texture info getter.
  const TextureInfo GetTextureInfo ( ID id );

  //! \brief	GL texture binding info getter.
  const ID GetGLTextureBindingID ( ID id );

  //! \brief	Texture exists check.
  bool HasTextureInfo ( ID id );

  //! \brief	Frees texture.
  void FreeTexture ( StompedReality::ID id );

  //! \brief	Reads data.
  //!			Reads data from the json value. No changes if parsing fails.
  //! \param	root	The json value.
  //! \return	Success parsing.
  bool ParseConfig ( Json::Value& root );

  //! \brief	Reads textures from file.
  bool ReadFromFile ( const char* fileName );
};

}
}
#endif // TEXTURESYSTEM_H
